# 求前 n 个数的平方和

# 自己写的
def set_fang(a):
    all_num = 0
    if a == 1:
        return 1
    else:
        while a > 0:
            all_num = all_num + a ** 2
            a = a - 1
        return all_num


wc = set_fang(5)
print(wc)


# 网站给的答案

def sum_of_squares(a):
    result = 0
    for i in range(1, a + 1):
        result += i ** 2
    return result


print(sum_of_squares(5))
